package com.common.core.scheduled;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class DynamicTaskTest {


    @Autowired
    private DynamicTask dynamicTask;

    public void test() throws InterruptedException {
        List<DynamicTask.TaskConstant> taskConstans = dynamicTask.getTaskConstants();
        DynamicTask.TaskConstant taskConstant = new DynamicTask.TaskConstant();
        taskConstant.setCron("0/5 * * * * ?");
        taskConstant.setTaskId("test1");
        taskConstant.setRule("每隔5秒执行");
        taskConstans.add(taskConstant);

        DynamicTask.TaskConstant taskConstant1 = new DynamicTask.TaskConstant();
        taskConstant1.setCron("0/8 * * * * ?");
        taskConstant1.setTaskId("test2");
        taskConstant1.setRule("每隔8秒执行");
        taskConstans.add(taskConstant1);
    }

}
